Add a test for duplicate build dependency
authorMohd Tarmizi <mohtar@users.noreply.github.com>
Mon, 13 Apr 2015 18:34:33 +0000 (02:34 +0800)
committerMohd Tarmizi <mohtar@users.noreply.github.com>
Tue, 14 Apr 2015 07:46:06 +0000 (15:46 +0800)
tests/test_cargo_compile_custom_build.rs

index ee438e03cd3a7364562b7353745ac39fcb3f9eb9..d5fc4057ab51d7467de799e1b6440fc0a1b56986 100644 (file)
@@ -1218,3 +1218,37 @@ test!(build_script_with_lto {
     assert_that(build.cargo_process("build"),
                 execs().with_status(0));
 });
+
+test!(test_duplicate_deps {
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [project]
+            name = "foo"
+            version = "0.1.0"
+            authors = []
+            build = "build.rs"
+
+            [dependencies.bar]
+            path = "bar"
+
+            [build-dependencies.bar]
+            path = "bar"
+        "#)
+        .file("src/main.rs", r#"
+            extern crate bar;
+            fn main() { bar::do_nothing() }
+        "#)
+        .file("build.rs", r#"
+            extern crate bar;
+            fn main() { bar::do_nothing() }
+        "#)
+        .file("bar/Cargo.toml", r#"
+            [project]
+            name = "bar"
+            version = "0.1.0"
+            authors = []
+        "#)
+        .file("bar/src/lib.rs", "pub fn do_nothing() {}");
+
+    assert_that(p.cargo_process("build"), execs().with_status(0));
+});